const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function (app) {
  app.use(
    '/api', // 指定需要代理的请求前缀
    createProxyMiddleware({
      target: 'http://8.138.115.85:8001',// http://8.138.115.85:8001,http://192.168.29.84:8001
      pathRewrite: {
        '^/api': '', // 将请求前缀重写为空，例如 /api/users -> /users
      },
    })
  );
};